home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / mad201.arc / MADIN201.DOC < prev   
Text File  |  1987-09-03  |  10KB  |  258 lines

  1.                     
  2.                      
  3.                         MADINPUT ver 2.01
  4.                          September 1987
  5.  
  6. Update Note: Version 2.01 is a minor update. It is exactly the same
  7. release as version 2.00 except that it includes a version of the code minus 
  8. line numbers for compiled-only usage. Details of the "how-to"
  9. use this compiled version are not included, it is assumed that anyone using 
  10. the compiler will already know how to integrate this code.
  11.  
  12. ***************************************************************************
  13.  
  14.                         MADINPUT VER 2.0
  15.                            March 1987
  16.  
  17.                          User Guidelines
  18.  
  19. ***************************************************************************
  20.  
  21. PREFACE TO VERSION 2.0: This is release 2.0 of MADINPUT. It replaces and
  22. supercedes the first release version 1.0.
  23.  
  24. It includes several improvements and enhancements including:
  25.  
  26. -The original release (version 1.0) consisted of two subroutines
  27.  at lines 20000 & 30000. This version has only 1 subroutine that
  28.  handles both numeric and alpha/numeric input. The subroutine 
  29.  starts at line 20000.
  30.  
  31. -Version 2.0 will fill and justify alphanumeric input fields.
  32.  
  33.  * Alphanumeric input fields will automatically be left or right
  34.    justified into fixed length fields and may be padded on the
  35.    left or right with any character selected by the user.
  36.  
  37.  * This feature greatly reduces the programmers need to manipulate
  38.    the data returned in variable SYSALPHA$ in order to make it
  39.    usable by the calling program.
  40.  
  41.  * For example : if the appropriate settings are initialized
  42.    the user may type "123" into a field defined as 5 characters.
  43.    MADIN200 can be configured to return "00123" in SYSALPHA$.
  44.    Alternatively, "  123" or "123  " or "123  " may also be
  45.    returned.
  46.  
  47.  * Likewise, keying "BROWN" into a field defined as 10 characters
  48.    can be set up to return "BROWN     " or "     BROWN" or
  49.    "-----BROWN", etc. The fill character is user selectable.
  50.  
  51. -Version 2.0 maintains SYSNUM! return of numeric only fields
  52.  
  53.  *Numeric only editing is still maintainable with the proper
  54.   initialization to accept only 0-9 from the keyboard
  55.  
  56.  * Note: when this functionality is used no justify or fill
  57.    takes place. (This may change with subsequent releases)
  58.  
  59. ***************************************************************************
  60. MADIN200 ia a subroutine of use to the novice and experienced 
  61. BASIC programmer who can make use of tailorable field input subroutines. 
  62.  
  63. This routine eleminates the need to perform the usual LOCATE, COLOR,
  64. and field setup chores for most programs. It is designed to be flexible
  65. and extremely easy to use.
  66.  
  67. In the simplest form usage is described below. First however
  68. let me explain the primary function.
  69.  
  70. The subroutine beginning at line 20000 returns to the user whatever
  71. input was keyed into the desired field. This data is returned to the
  72. user in a string variable named SYSALPHA$ or in numeric variable SYSNUM,
  73. depending on the calling programs setup.
  74.  
  75. MADIN200 Performs the following functions:
  76.  
  77.         - Locate to the desired row & column
  78.         - Print a field-mask showing the user the field-size
  79.         - Position a custom-designed cursor at the beginning of the field
  80.         - Allow only valid keystrokes (numeric or string)
  81.         - Force carriage return to exit the field
  82.         - Replace 'backspaced-over' characters with the field mask character
  83.         - Return the string or variable to the main body of the program
  84. Ver 2.0 - Left or Right Justify Alphanumeric data into fixed length format
  85.         - Pad leading or trailing positions with any user selected character,
  86.           (usually 0 or blank).
  87.  
  88.  
  89. While there is nothing too exotic about all this, the routines are usefull
  90. because of their unique tailorability thru variable set-up. This
  91. is described as follows:
  92.  
  93.         Variable Name                   Usage
  94.         =============         =======================================
  95.  
  96.         ROW%                    LOCATE TO THE ROW NUMBER IN THIS VARIABLE
  97.  
  98.         COL%                    LOCATE TO THE COLUMN NUMER IN THIS VARIABLE
  99.  
  100.         FLDSIZ%                 THE SIZE  (LENGTH) OF THE INPUT FIELD
  101.  
  102.         FLDFG%                  THE FOREGROUND COLOR VALUE OF THE FIELD
  103.                                 MASK CHARACTER
  104.  
  105.         FLDBG%                  THE BACKGROUND COLOR VALUE OF THE FIELD
  106.                                 MASK CHARACTER
  107.  
  108.         CURSFG%                 THE FOREGROUND COLOR VALUE OF THE CURSOR
  109.                                 CHARACTER
  110.  
  111.         CURSBG%                 THE BACKGROUND COLOR VALUE OF THE CURSOR
  112.                                 CHARACTER
  113.  
  114.         CHRFG%                  THE FOREGROUND COLOR VALUE OF THE ACTUAL
  115.                                 DATA ENTERED BY THE USER
  116.  
  117.         CHRBG%                  THE BACKGROUND COLOR VALUE OF THE ACTUAL
  118.                                 DATA ENTERED BY THE USER
  119.  
  120.         FLDCHR%                 THE ASCII CHARACTER CODE OF THE FIELD MASK
  121.  
  122.         CURCHR%                 THE ASCII CHARACTER CODE OF THE CUSTOM CURSOR
  123.  
  124.  
  125. Ver 2.0 FILCHR$                 THIS IS THE USER SELECTABLE FILL CHARACTER
  126.  
  127.    "    SYSTYP%                 THIS IS THE USER DEFINABLE INPUT TYPE:
  128.                                 SYSTYP%=1  SET UP RIGHT JUSTIFIED &     
  129.                                            LEFT FILLED ALPHANUMERIC INPUT
  130.  
  131.                                 SYSTYP%=2  SET UP NUMERIC (0-9 ONLY)
  132.                                            NO FILL, NO JUSTIFY, DATA RETURNED
  133.                                            IN SYSNUM!
  134.  
  135.                                 SYSTYP%=3  SET UP LEFT JUSTIFIED &
  136.                                            RIGHT FILLED ALPHANUMERIC INPUT
  137.  
  138.         SYSFIL$                 VARIABLE USED BY THIS ROUTINE, NOT FOR
  139.                                 USE BY USER
  140. The subroutines supplied contain certain default setting for each of
  141. these variables at the top section prior to line 20000. You obviously
  142. may wish to change them.
  143.  
  144. A simple sample example of using this routine can be constructed as 
  145. follows:
  146.  
  147. 1. Load the subroutins as supplied into the BASIC interpreter.
  148. 2. Add the following lines of code:
  149.  
  150.         300 CLS
  151.         350 COLOR 10,0
  152.         400 REM -------------SAMPLE ALPHA INPUT RIGHT JUSTIFY ZERO FILL--
  153.         420 LOCATE 8,1:PRINT "ENTER A NUMBER OF 1 TO 5 CHARACTERS"
  154.         450 ROW%=10 : COL%=1 : FLDSIZ%=5 : SYSTYP%=1 : FILCHR$="0"
  155.         500 GOSUB 20000
  156.         550 LET A$=SYSALPHA$
  157.         575 REM -------------SAMPLE USAGE OF NUMERIC ROUTINE-------------
  158.         600 ROW%=12 : COL%=1 : FLDSIZ%=3 : SYSTYP%=2 : GOSUB 30000 : B=SYSNUM
  159.         650 REM ---------------------------------------------------------
  160.         700 LOCATE 10,15:PRINT A$;
  161.         800 LOCATE 12,15:PRINT B;
  162.         900 FOR X=1 TO 700:NEXT X
  163.        1000 GOTO 300
  164.  
  165. Obviously, any line can include as little parameter-ization as line
  166. 600 in the example above, or as much as color , mask character, and
  167. cursor character changes.
  168.  
  169. For Example :     
  170.  
  171. 600 ROW%=10:COL%=12:FLDSIZ%=4:FLDCHR%=249:CURCHR%=177:CHRBG%=14:SYSTYP%=1
  172. 605 GOSUB 20000
  173. 610 ACCOUNT$=SYSALPHA$
  174.  
  175.  
  176. Note that only the variables representing changing input requirements
  177. need be specified, if you were inputing a series of numbers, and wanted
  178. no formatting you could simply do the following:
  179.  
  180. (assuming you have included the setup statements prior to line 20000 at
  181.  the top of your program)
  182.  
  183.         ROW%=10:COL%=1:GOSUB 20000
  184.         ACCT=SYSNUM
  185.         ROW%=11:COL%=1:GOSUB 20000
  186.         QTY=SYSNUM
  187.         ROW%=12:COL%=1:GOSUB 20000
  188.         COUNT=SYSNUM
  189.         
  190.         TOTAL=QTY*COUNT
  191.         PRINT TOTAL
  192.  
  193. ...then to turn on left-justify and blank fill to the right
  194.  
  195.         ROW%=20:COL%=1:SYSTYP%=3:FILCHR$=" ":GOSUB 20000
  196.         NAME$=SYSALPHA$
  197.         PRINT NAME$
  198. ...and then right-justify and zero fill to the left
  199.  
  200.         ROW%=23:COL%=1:SYSTYP%=1:FILCHR$="0":GOSUB 20000
  201.         ZIPCODE$=SYSALPHA$
  202.         PRINT ZIPCODE$
  203.  
  204. ......and so forth
  205.  
  206. While there are a whole lot of modifiable parameters, very few need change
  207. to actually use the "standard" function of this routine.
  208.  
  209.  
  210. Feel free to experiment with these routines and use them if they can benefit
  211. you. Chances are if you're an experienced programmer you have somthing
  212. very similiar, and perhaps a lot slicker. If not, then these may be of
  213. real benefit to you.
  214.  
  215. Future revisions will eventually make their way as I complete them.
  216.  
  217. I may be reached at the address below, or preferably via Compuserve.
  218.  
  219. I will respond to meaningfull correspondence.
  220.  
  221.  
  222. Suggestions are very welcome.
  223.  
  224.  
  225. As with any public domain donation, this author accepts supporting
  226. contributions if you feel this product warrants your support.
  227.  
  228. You support can be in the form of feedback, suggestions or criticisms,
  229. and of course monetary support. If you decide on monetary support
  230. a $7 contribution is suggested.
  231.  
  232. Also, there are a few rules (the usual stuff) regarding ANY use of these
  233. routines:
  234.  
  235.         1-They may be freely exchanged, shared, or copied without
  236.           reservation for non commercial private use for which
  237.           no profit or gain has been incurred    
  238.         2-If distributed in any form they must be complete and   
  239.           UN-MODIFIED and include this documentation
  240.         3-They may be used in commercial applications of programs
  241.           written for profit or gain ONLY if such use is registerd
  242.           with the author at the address below and if such
  243.           usage-registration is accompanied with a one-time fee
  244.           of $20.00
  245.          
  246.  
  247. Thank you.
  248.  
  249. HAWKE SYSTEMS LTD.
  250. Michael Dalton
  251. 283 Dahlia Drive 
  252. Louisville CO 80027
  253.  
  254. Compuserve ID: 71410,2624
  255.  
  256.      MADINPUT version 2.0 MADIN200 released to public domain 3/22/87
  257.         copyright 1987 by Michael A. Dalton & Hawke Systems Ltd.
  258.